import Vue from "vue";
import App from "./App.vue";
import ElementUI from 'element-ui';
import './style/common.less'
import 'element-ui/lib/theme-chalk/index.css';
import router from "./router"
import './components'

Vue.use(ElementUI);
Vue.config.productionTip = false;

Vue.directive('loadmore', {
    bind(el, binding) {
        var p = 0;
        var t = 0;
        var down = true;
        var selectWrap = el.querySelector('.hotTable')
        selectWrap.addEventListener('scroll', function () {
            //判断是否向下滚动
            p = this.scrollTop;
            // if ( t < p){down=true}else{down=false}
            if (t < p) {
                down = true;
            } else {
                down = false;
            }
            t = p;
            //判断是否到底
            const sign = 10;
            const scrollDistance = this.scrollHeight - this.scrollTop - this.clientHeight
            if (scrollDistance <= sign && down) {
                binding.value()
            }
        })
    }
})

new Vue({
    router,
    render: h => h(App)
}).$mount("#app");